package com.edu.method;

import java.util.Scanner;

public class MethodDemoPractice01 {
    public static void main(String[] args) {
        //小总结案例：买飞机票
        //首先输入飞机票的原价、月份、淡季还是旺季
        System.out.println("请输入你选择的飞机票原价、月份、仓位类型");
        Scanner s = new Scanner(System.in);
        double money = s.nextDouble();//飞机票原价
        int month = s.nextInt();//月份
        String type = s.next();//淡季还是旺季
        System.out.println("飞机票最终价格为"+sumPrice(money, month, type));
    }
    //计算总的飞机票价格的方法
    public static double sumPrice(double money,int month,String type){
        if(month>0&&month<=12){
            if(month<5&&money>10){
                switch (type){
                    case "头等舱":
                        money*=0.7;
                        break;
                    case "经济舱":
                        money*=0.65;
                        break;
                }
            }else{
                switch (type){
                    case "头等舱":
                        money*=0.9;
                        break;
                    case "经济舱":
                        money*=0.85;
                        break;
                }
            }
        }else {
            System.out.println("你输入的月份有误");
            money=-1;
        }
        return money;
    }
}
